<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path;

%>
<html>
<head>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="IMG/favicon.ico">


    <title>人员管理</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <!-- Bootstrap core CSS -->
    <link href="static/css/dist/css/bootstrap.min.css?v=1" rel="stylesheet">
    <!-- Bootstrap theme -->
    <link href="static/css/dist/css/bootstrap-theme.min.css" rel="stylesheet">
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <link href="static/css/assets/css/ie10-viewport-bug-workaround.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="static/css/theme.css" rel="stylesheet">

    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->

    <!--[if lt IE 9]>
    <script src="static/css/assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
    <script src="static/css/assets/js/ie-emulation-modes-warning.js"></script>

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>

    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>


    <![endif]-->
</head>

<body role="document">


<!-- Fixed navbar -->
<jsp:include page="top.jsp" flush="true"/>

<div class="container">

    <div class="panel panel-default">
        <!-- Default panel contents -->
        <div class="panel-heading" style="font-family:微软雅黑;">
            <span>人员配置</span>
        </div>
        <div class="panel-body" style="font-family:微软雅黑;">

            <form class="form-inline" name="searchForm" action="searchUser" method="post">
                <div class="form-group">
                    <label for="exampleInputName2">登录名</label>
                    <input type="text" name="searchLoginName" class="form-control" id="exampleInputName2"
                           placeholder="登录名" value="${searchLoginName}">
                </div>
                <div class="form-group">
                    <label for="exampleInputName3">姓名</label>
                    <input type="email" name="searchRealName" class="form-control" id="exampleInputName3"
                           placeholder="姓名" value="${searchRealName}">
                </div>
                <button type="submit" class="btn btn-default">搜索</button>
                <button type="button" id="deleteButton" name="deleteButton" onClick="deleteTable()"
                        class="btn btn-default">
                    删除
                </button>
                <button type="button" id="loadButton" name="loadButton" data-toggle="modal" data-target="#myModal"
                        class="btn btn-default">
                    新增
                </button>
                &nbsp;
                <span style="color:#FF0000">${msg}</span>
            </form>


        </div>
        <!-- Modal -->
        <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                                aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="myModalLabel">添加用户</h4>
                    </div>
                    <div class="modal-body" style="font-family:微软雅黑;">
                        <form class="form-horizontal" action="addUserInfo" method="post" name="addForm">
                            <div class="form-group">
                                <label for="exampleInputEmail1" class="col-sm-2 control-label">登录名</label>

                                <div class="col-sm-10">
                                    <input name="userName" type="email" class="form-control" id="exampleInputEmail1"
                                           placeholder="Email">
                                </div>
                            </div>

                            <div class="form-group">
                                <label for="exampleInputPassword1" class="col-sm-2 control-label">密码</label>

                                <div class="col-sm-10">
                                    <input name="userPassword" type="password" class="form-control"
                                           id="exampleInputPassword1" placeholder="Password">
                                </div>
                            </div>

                            <div class="form-group">
                                <label for="exampleInputRealName" class="col-sm-2 control-label">姓名</label>

                                <div class="col-sm-10">
                                    <input name="userRealName" type="text" class="form-control"
                                           id="exampleInputRealName" placeholder="Name">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="exampleInputMobile" class="col-sm-2 control-label">手机号</label>

                                <div class="col-sm-10">
                                    <input name="userPhone" type="text" class="form-control" id="exampleInputMobile"
                                           placeholder="IPhone">
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="exampleInputMobile" class="col-sm-2 control-label">部门</label>

                                <div class="col-sm-10">
                                    <select class="form-control" name="userCity" id="userCity">

                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label for="yixinNick" class="col-sm-2 control-label">易信名字</label>

                                <div class="col-sm-10">
                                    <input name="yixinNick" type="text" class="form-control" id="yixinNick"
                                           placeholder="易信名字">
                                </div>
                            </div>
                            <div class="form-group" align="right">
                                <button type="submit" class="btn btn-default">添加</button>
                                &nbsp;&nbsp;&nbsp;
                            </div>
                        </form>

                    </div>

                </div>
            </div>
        </div>
        <!-- Table -->
        <form name="deleteForm" id="deleteForm" method="post">
            <table class="table" style="font-family:微软雅黑;">
                <tr>
                    <th>选择</th>
                    <th>序号</th>
                    <th>登录名</th>
                    <th>姓名</th>
                    <th>电话</th>
                    <th>邮件</th>
                    <th>部门</th>
                    <th>易信名字</th>
                    <th>操作</th>

                </tr>
                <%int i = 0;%>
                <c:forEach items="${userMap}" var="map">
                    <tr>
                        <td>

                            <input type="checkbox" name="userList" value="${map.key.userModelId}">

                        </td>
                        <td><%=++i%>
                        </td>
                        <td>${map.key.userLoginName}</td>
                        <td>${map.key.userRealname}</td>
                        <td>${map.key.userPhone}</td>
                        <td>${map.key.userEmail}</td>
                        <td>${map.value.cityName}</td>
                        <td>${map.key.nick}</td>
                        <th><a href="loadUserMenuList?userId=${map.key.userModelId}">赋权</a>|<a
                                href="resetPassword?userId=${map.key.userModelId}">初始化</a></th>
                    </tr>
                </c:forEach>

            </table>
        </form>
    </div>

</div>
<!-- /container -->


<jsp:include page="bottom.jsp" flush="true"/>


<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->

<script src="static/js/jquery.min.js"></script>
<script src="static/js/jquery.json.min.js"></script>
<script src="static/css/dist/js/bootstrap.min.js"></script>
<script src="static/css/assets/js/docs.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="static/css/assets/js/ie10-viewport-bug-workaround.js"></script>
<!--
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
-->
<script>
    $(document).ready(function () {
        /* 获取数据源 */
        $.post("loadCity", function (data) {

            var jsonObj = data;

            for (var i = 0; i < jsonObj.length; i++) {
                var $option = $("<option></option>");
                $option.attr("value", jsonObj[i][0]);
                $option.text(jsonObj[i][1]);
                $("#userCity").append($option);

            }
        });
    });
    function deleteTable() {

        document.deleteForm.action = 'deleteUser';
        document.getElementById("deleteForm").submit();

    }


</script>
</body>
</html>
